package com.sskj.wallet.presenter;

import com.hjq.toast.ToastUtils;
import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.wallet.bean.AddressAllBean;
import com.sskj.wallet.ui.activity.AddressListActivity;


/**
 * @author Hey
 * Create at  2019/06/26
 */
public class AddressListPresenter extends BasePresenter<AddressListActivity> {

    public void getAddressList() {
        httpService.getAddressList()
                .tag(this)
                .execute(new JsonCallBack<HttpData<AddressAllBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<AddressAllBean>> response) {
                        mView.getAddressListOK(response.body().getData());
                    }
                });
    }

    public void deleteAddress(AddressAllBean.BtcBean data,String type) {
        httpService.addAddress(data.getQiaobao_url(), "del", data.getNotes(), type)
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        getAddressList();
                    }
                });
    }
}
